import time

import pyautogui

while True:
    time.sleep(0.5)
    current_mouse_x, current_mouse_y = pyautogui.position()
    print(f"当前鼠标坐标: X={current_mouse_x}, Y={current_mouse_y}")